<?php
$headermsg = '\"HTTP/1.0 '.$code[0].' '.$code[1].'\"';
header($headermsg);
$ratingcount = 0;

echo "{\"ratings\":[";
foreach($ratings as $rating){
	if ($ratingcount != 0){
		echo ",";
	}
	$ratingcount = 1;
	echo "{\"rating\":{";
	echo "\"id\":\"".$rating['Rating']['id']."\",";
	echo "\"photo_id\":\"".$rating['Rating']['photo_id']."\",";
	echo "\"user_id\":\"".$rating['Rating']['user_id']."\",";
	echo "\"value\":\"".$rating['Rating']['value']."\"}";
	echo "}";
	}
echo "]}";
?>